package main

import (
	"fmt"
	"time"
)

// 定义结构体 Address 和 VCard，后者包含一个人的名字、地址编号、出生日期和图像，试着选择正确的数据类型。构建一个自己的 vcard 并打印它的内容。

type Address struct {
	Zipcode  string
	Province string
	City     string
	Street   string
}

type VCard struct {
	FirstName string
	LastName  string
	BirthDay  time.Time
	Picture   string
	Addresses map[string]*Address
}

func main() {
	addr1 := Address{"570000", "Hainan", "Shanya", "fenghuang street"}
	addr2 := Address{"100000", "Beijing", "Beijing", "front door street"}
	addrs := make(map[string]*Address)
	addrs["now"] = &addr1
	addrs["old"] = &addr2
	birth := time.Date(1966, 6, 16, 15, 14, 12, 0, time.Local)

	myCard := &VCard{"Wei", "Hua", birth, "./pictures/avatar.jpg", addrs}

	fmt.Printf("myCard: %v\n", myCard)
	fmt.Printf("my address old: %v, now: %v. \n", myCard.Addresses["old"], myCard.Addresses["now"])

}
